
	/***********************************************************************************************
	  
		Module: Jsl
			
		Base:
			mod			require						(mods/libs..)															- sid: 5.0
			mod			load							(urls..)																	- sid: 5.0
			data		service						(url, params*)														- sid: 5.0				

			obj			getObject					(oid)																			- sid: 5.0
			mod			augment						(selectors..)															- sid: 5.0
		
		Console:								
			msg			console.debug			(msg, params..*)													- sid: 5.0
			msg			console.info			(msg, params..*)													- sid: 5.0
			msg			console.warn			(msg, params..*)													- sid: 5.0
			msg			console.error			(msg, params..*)													- sid: 5.0
			msg			console.log				(values..)																- sid: 5.0
		
		Timers:																	
			tid			delay							(action, time*)														- sid: 5.0
			tid			timer							(action, interval, n*)										- sid: 5.0
			b				removeTimer				(tid)																			- sid: 5.0
		
		Url:	
			mod			setUrlSchema			(id, url)																	- sid: 5.0
			url			getUrlSchema			(id)																			- sid: 5.0				
		
		System messages:
			mod			setMessage				(id, msg)																	- sid: 5.0		
			msg			getMessage				(id)																			- sid: 5.0
			msg			compileMessage		(id, params..*)														- sid: 5.0						
		
		Errors:
			mod			defineError				(name, super*, msg*)											- sid: 5.0
							throwError				(e, cx*, args*)														- sid: 5.0
			mod			captureError			(e, cx*, args*)														- sid: 5.0
		
		Introspection:
			b				isAugmented				(v)																				- sid: 5.0
			b				isArray						(v)																				- sid: 5.0
			b				isArrayLike				(v)																				- sid: 5.0
			b				isBoolean					(v)																				- sid: 5.0
			b				isClass						(v)																				- sid: 5.0
			b				isDate						(v)																				- sid: 5.0
			b				isError						(v)																				- sid: 5.0
			b				isFunction				(v)																				- sid: 5.0
			b				isInteger					(v)																				- sid: 5.0
			b				isInterface				(v)																				- sid: 5.0
			b				isModule					(v)																				- sid: 5.0
			b				isNumber					(v)																				- sid: 5.0
			b				isObject					(v)																				- sid: 5.0
			b				isRegExp					(v)																				- sid: 5.0
			b				isString					(v)																				- sid: 5.0
			b 			isSubTypeOf				(type, type2)															- sid: 5.0
			b 			isSuperTypeOf			(type, type2)															-	sid: 5.0
		
		Debug:
			mod			defineValidationRule	(id, rule)														-	sid: 4.0
			mod			validate							(v, id, param*, error*)								-	sid: 4.0

		Objects:							
							eventBus					

		Infos:
							app					{ url, fileName, protocol, hostName, hostPort, pathName, params, hash	}
							liquid			{ version }
							system			{ id, type, version, versionId, os, context }
							javascript	{ version }

		Options:
							error				{ capture: { action, enabled } }
							liquid			{ url, debug, log }
							script			{ url }
							load				{ timeout }
							service			{ timeout }		

		Events:
							beforeInit, beforeBoot, beforeExit, beforeError	, beforeLoad, beforeService	, beforeLoadTimeOut	, beforeServiceTimeOut				
							init			, boot			, exit			,	error				, load			, service				, loadTimeOut				, serviceTimeOut	
							
		Note:
			action	-> f(tid, i[1,Infinity])
			log			->	none, error, warn, info, debug			
			the jsl keyword (instead of this)is used inside the module but only in error creation is-queries and validation
			for uniformity
																									
	************************************************************************************************/
	
	//Module init
	//-------------------------------------------------------------------------------
	;(function() {
		try {
			var mod

			//-------------------------------------------------------------------------------
			mod	= new jsl.Module("jsl")
			for(var id in jsl) if(jsl.hasOwnProperty(id)) mod[id] = jsl[id]
      jsl =	mod
					
			jsl.console	= function() { 
				try 			{ return jsl.console.log.apply(this, arguments) } 
				catch(e) 	{ jsl.throwError(e, this, arguments) 						}
			} 
			
			jsl.console.__name			= "jsl.console"
			jsl.__ready							= false
			jsl.__debug							= 2
			jsl.__load_to						= 10000
			jsl.__service_to				= 10000
			jsl.__objs							= {}
			jsl.__log								= "debug"
			jsl.__stype							= null

			jsl.__schemes						= {}
			
			//natives
			jsl.__schemes["https"]	= "https://"
			jsl.__schemes["http"]		= "http://"
			jsl.__schemes["file"]		= "file://"
			
			//abstracts
			jsl.__schemes["app"]		= null
			jsl.__schemes["liquid"]	= null
			jsl.__schemes["script"]	= null
						      
			jsl.eventBus 						= new jsl.EventMap
			jsl.eventBus.setName("jsl.eventBus")
			
      //Events
			//-------------------------------------------------------------------------------
			jsl.addEvents("beforeInit"	, "beforeBoot"		, "beforeExit"				, "beforeError")
			jsl.addEvents("beforeLoad"	, "beforeService"	, "beforeLoadTimeOut"	, "beforeServiceTimeOut")
			
			jsl.addEvents("init"				,	"boot"					, "exit"							, "error")
			jsl.addEvents("load"				, "service"				, "loadTimeOut"				, "serviceTimeOut")

			//Infos
			//-------------------------------------------------------------------------------
			jsl.addInfo("app")
			jsl.addInfo("liquid")
			jsl.addInfo("system")
			jsl.addInfo("javascript")

      jsl.addInfo("liquid.version", jsl.__version)
			jsl.addInfo("system.context", jsl.__go)
	
			//Options
			//-------------------------------------------------------------------------------
			jsl.addOption("error")
			jsl.addOption("error.capture")
			jsl.addOption("liquid")
			jsl.addOption("script")
			jsl.addOption("load")
			jsl.addOption("service")

			jsl.addOption("error.capture.action", {
				getter: function(v, oldv, id) { return v ||	jsl.__ni_error_capture },
				setter: function(v, oldv, id) {					
					if(v != null) jsl.validate(v, "f", id)
					return v || jsl.__ni_error_capture
				}
			})

			jsl.addOption("error.capture.enabled", {
				dvalue: true,
				setter: function(v, oldv, id) {					
					//@d[
					jsl.validate(v, "b", id)//@d]
					return !!+v
				}
			})
			
			jsl.addOption("liquid.debug", {
				dvalue:	2,
				setter: function(v, oldv, id) {
					//@d[
					jsl.validate(v, "i[0,2]", id)//@d]
					return jsl.__debug = +v
				}
			})

			jsl.addOption("liquid.log", {
				dvalue:	"debug",
				setter: function(v, oldv, id) {
					//@d[
					jsl.validate(v, "enum[none,error,warn,info,debug]", id)//@d]
					return jsl.__log = v + ""
				}
			})

			jsl.addOption("load.timeout", {
				dvalue:	10000,
				setter: function(v, oldv, id) {
					//@d[
					jsl.validate(v, "i+", id)//@d]
					return jsl.__load_to = +v
				}
			})
			
			jsl.addOption("service.timeout", {
				dvalue:	10000,
				setter: function(v, oldv, id) {
					//@d[
					jsl.validate(v, "i+", id)//@d]
					return jsl.__service_to = +v
				}
			})
		}
		catch(e) {
			//all console display the message of the error but we want also the stacktrace
			throw Error(jsl.Error(e).trace("jsl()") + "")
		}
	})()
	//-------------------------------------------------------------------------------
	jsl.__boot =  function() {
		try {
			var b, e

			e 						= new jsl.Event
			e.app 				= jsl.getInfo("app")
			e.system 			= jsl.getInfo("system")
			e.javascript	= jsl.getInfo("javascript")
			e.liquid 			= jsl.getInfo("liquid")
			b 						= !jsl.throwEvent("beforeInit", e).STOP_EVENTS
			
			jsl.console.info("liquid ready (" + (jsl.__debug ? "debug" : "deploy") + " mode)")
			jsl.console.info("system detected: " + e.system.id + " v." + e.system.versionId)
			
			b && jsl.console.info("event: init")
			
			if(b && !jsl.throwEvent("init", e).STOP_EVENTS) {
			
				jsl.throwEvent("beforeBoot", e)				
				jsl.console.info("event: boot")
				jsl.throwEvent("boot", e)
			}
			else
				jsl.console.info("InitStop")
		}
		catch(e) {
			jsl.captureError(e, "jsl.boot()")
		}		
	}
	//-------------------------------------------------------------------------------
	jsl.__exit = function() {
		try {
			jsl.throwEvent("beforeExit")
			jsl.console.info("event: exit")
			jsl.throwEvent("exit")
		}
		catch(e) {
			jsl.captureError(e, "jsl.exit()")
		}
	}
	//-------------------------------------------------------------------------------
	jsl.require = function() {
		try {
			var id, lurl, url, script, e
			
			//@d[
			if(!arguments.length)	throw jsl.ParamError()//@d]

			lurl = this.getOption("liquid.url")
			if(!lurl)	throw jsl.ConfigError("NotDefined:option(liquid.url)")
						
			for(var a = 0; a < arguments.length; a++) {

				id = arguments[a]
				//@d[
				this.validate(id, "qid", "ids[" + a + "]")//@d]				
				id = id.toLowerCase()
				
				//@d[
				if(!this.__wkmods[id] && !this.__wklibs[id])	throw jsl.ParamError("NotDefined:id")//@d]
															
				if(!this.__mods[id] && !this.__libs[id]) {
					
					url 	= lurl + (this.__wkmods[id] ? "mod/" : "lib/") + id + ".js"							
					url 	= url.replace(/\\/g, "/")
					e 		= new jsl.Event
					e.url = url 
					
					this.throwEvent("beforeLoad", e)

					script = this.__ni_script_load(url)
					if(script == null)	throw jsl.NotFoundError("NotFound", [ url ])
					
					//\r is \r not \n. We save the script in windows os therefore a \n in windows is \r\n					
					if(this.__debug === 2) 	script = "\"lazy load: " + url + "\";\n" + script
					else										script = script.replace(/\/\/@d\{[\s\S]+?\/\/@d\}.*\r\n/g, "").replace(/\/\/@d\[[\s\S]+?\/\/@d\].*\r\n/g, "")

					//@sys: Opera 10.53/Konqueror - Function('eval...') and more in general, multiple sub evalutations 
					//			can generate problems when a function is converted into string. The string can be corrupted 
					//			ex: the result can be a string without 'function' keyword  
					try 			{	this.__ni_script_execute(script)																}
					catch(e) 	{ throw (e instanceof jsl.ScriptError ? e.setScriptName(url) : e)	}					
				
					this.console.info("event: load(" + url + ")")
					this.throwEvent("load", e)
				}
			}
			return this		
		}
		catch(e) {
			jsl.throwError(e, this, arguments)
		}
	}	
	//-------------------------------------------------------------------------------
	jsl.load = function() {
		try {
			var url, schema, e, script
			
			//@d[
			if(!arguments.length)	throw jsl.ParamError()//@d]

			for(var a = 0; a < arguments.length; a++) {

				url = arguments[a]
				
				//@d[
				jsl.validate(url, "url+", "urls[" + a + "]")//@d]

				url 		= url.replace(/\\/g, "/")
				schema 	= url.replace(/\s+/g, "").match(/^[^:]+/)
				//@d[
				if(!this.__schemes[schema])	throw jsl.ParamError("NotDefined:urls[" + a + "](schema)")//@d]				
				url = this.__schemes[schema] + url.match(/\/\/(.+$)/)[1]
												
				e 		= new jsl.Event
				e.url	= url 
				
				this.throwEvent("beforeLoad", e)

				script = this.__ni_script_load(url)
				if(script == null)	throw jsl.NotFoundError("NotFound", [ url ])
								
				//a comment can be removed from the sources by the debugger, a string no
				if(this.__debug) 
					script = "\"lazy load: " + url + "\";\n" + script
				 					
				try 			{	this.__ni_script_execute(script)																}
				catch(e) 	{ throw (e instanceof jsl.ScriptError ? e.setScriptName(url) : e)	}					
								
				this.console.info("event: load(" + url + ")")
				this.throwEvent("load", e)
			}
			return this
		}
		catch(e) {
			jsl.throwError(e, this, arguments)
		}
	}
	/*-------------------------------------------------------------------------------
		Service parameter:		  
			content:	[ json(d) | xml | serial | text ]
			
	  Listeners:	
	  	onComplete, onError
	 
	//-------------------------------------------------------------------------------*/
			
	jsl.service = function(url, params) {
		try {
			var nurl, schema, onComplete, content, e, data, pms, async, b
			
			//@d[
			if(!arguments.callee || arguments.length > 2)	throw jsl.ParamError()
			jsl.validate(url, "url+", "url")//@d]

			pms	= {}

			if(arguments.length === 2) {
				//@d[
				if(params == null)	throw jsl.ParamError("NullValue:params")//@d]
							
				if(jsl.isString(params))					pms.content 		= params
				else if(jsl.isFunction(params))		pms.onComplete 	= params
				
				else if(jsl.isObject(params)) {
					//@d[			
					if(params.content 		!= null)	jsl.validate(params.content		, "enum(json,xml,text,serial)", "params.content")
					if(params.onComplete 	!= null)	jsl.validate(params.onComplete, "f", "params.onComplete")
					if(params.onError 		!= null)	jsl.validate(params.onError		, "f", "params.onError")//@d]
					
					pms.content 		= params.content
					pms.onComplete 	= params.onComplete
					pms.onError 		= params.onError
				}//@d[
				else 
					throw jsl.ParamError("BadType:[ string | function | object ]")//@d]
			}
			
			nurl		= url.replace(/\s+/g, "")
			schema 	= nurl.match(/^[^:]+/)//@d[			
			if(!this.__schemes[schema])	throw jsl.ParamError("NotDefined:url(schema)")//@d]				

			nurl 		= this.__schemes[schema] + nurl.match(/\/\/(.+$)/)[1]
			content	= pms.content || "json"
			async		= !!pms.onComplete			
								
			if(async) {

				onComplete				= pms.onComplete
				pms.__onComplete 	= function(s) {
					var obj
					
					try {
						if(content === "text") 
							obj = s
						else {
							jsl.require("encode")
							if(content === "json")			obj = jsl.Encode.fromJson(s)
							else if(content === "xml")	obj = jsl.Encode.fromXml(s)						
							else												obj = jsl.Encode.deserialize(s)
						}
					}
					//@sys: Explorer 8 - e2 instead of e because of a closure bug 
					//see below				
					catch(e2) {
						b = pms.__onError(e2)
						if(b == null || b)	throw e2
					}
					
					e.data = obj
											
					//@sys: Explorer 8 - e2 instead of e because of a closure bug 
					//see below				
					try 			{ onComplete(e) 																							}
					catch(e2) { jsl.throwError(e2, "jsl.service.onComplete(data)", [ obj ])	}					
					
					jsl.console.info("event: service(" + nurl + ")")
					jsl.throwEvent("service", e)
					
					return obj
				}
			}
			
			pms.__onError = function(error) { e.error = error; return params.onError ? params.onError(e) : null }
			e							= new jsl.Event
			e.content			= content 
			e.url					= nurl
			e.async				= async

			delete pms.content
			delete pms.onComplete
			delete pms.onError
			
			this.throwEvent("beforeService", e)

			data = jsl.__ni_http_request(nurl, pms)

			if(!async) {
				
				try {				
					if(content !== "text") {
						jsl.require("encode")
						if(content === "json")			data = jsl.Encode.fromJson(data)
						else if(content === "xml")	data = jsl.Encode.fromXml(data)						
						else												data = jsl.Encode.deserialize(data)
					}
				}
				//@sys: Explorer 8 - e2 instead of e because in case of error the function context 
				//is augmented with e and when the above __onComplete function is called 
				//e results equals to undefined. Closure bug.
				//Despite this bug, if an error is throwed it replace the content of the e var that becomes
				//not an instance of jsl.Error, it is wrong
				catch(e2) {
					b = pms.__onError(e2)
					if(b == null || b)	throw e2
				}
				
				this.console.info("event: service(" + nurl + ")")

				e.data = data			
				this.throwEvent("service", e)
			}
									
			return data 									
		}
		catch(e) {
			jsl.throwError(e, this, arguments)
		}
	}
	//-------------------------------------------------------------------------------
	jsl.getObject = function(oid) { 
		try {
			//@d[
			if(arguments.length !== 1)	throw jsl.ParamError()
			jsl.validate(oid, "s+", "oid")//@d]
			
			return this.__objs[oid] || null
		}
		catch(e) {
  		jsl.throwError(e, this, arguments)			
		}
	}
	//-------------------------------------------------------------------------------
	jsl.augment = function()  { 
		try {		
			//Object in first position, see below
			var bts = [ Object	, Array		, Boolean		, Date	, Error		, Function	, Number	, RegExp	, String 		]
			var lqs = [ "Object", "Array"	, "Boolean"	, "Date", "Error"	, "Function", "Number", "RegExp", "String" 	]
			
			var args, arg, len, from, to, idx, name, id
			
			args 	= arguments
			len 	= args.length 
			arg		= args[0]
			
			//@d[				
			if(!len)	throw jsl.ParamError()//@d]
			
			//1° - */**
			if(jsl.isString(arg)) {
				
				//@d[
				if(len > 1)										throw jsl.ParamError()
				if(arg != "*" && arg != "**")	throw jsl.ParamError("BadValue:seelctor")
				//@d]
				
				if(arg == "*")	this.augment.apply(this, bts.slice(1))
				else 						this.augment.apply(this, bts)
			}
			//2° - constructors list
			else 		
				for(var a = 0; a < len; a++) {
					
					arg	= args[a]
					idx = jsl.Object.isIn(arg, bts)
					
					//@d[
					if(!idx)	throw jsl.ParamError("BadType:jsc[" + a + "]")//@d]	
					name = lqs[idx - 1]
					
					if(!jsl[name]) 
						jsl.require("lang")				
					
					from 	= jsl[name].prototype
					to		= arg.prototype
					for(id in from)	if(from.hasOwnProperty(id))	to[id] = from[id]				
				
					//static
					from 	= jsl[name]
					to		= arg
					for(id in from)	if(from.hasOwnProperty(id)) to[id] = from[id]				
				}						
												
			return this		
		}
		catch(e) {
			jsl.throwError(e, this, arguments)
		}
	}
	//-------------------------------------------------------------------------------
	jsl.console.debug = function(msg) {
		try {
			var txt
			
			//@d[
			if(!arguments.length)	throw jsl.ParamError()//@d]
			
			for(var a = 1, params = []; a < arguments.length; a++)
				if(jsl.isArray(arguments[a])) params = params.concat(arguments[a])
				else													params.push(arguments[a])
			
			txt = jsl.compileMessage(msg + "", params)
			if(this.__log === "debug")	jsl.__ni_stdout_debug(txt)
			return txt
		}
		catch(e) {
			jsl.throwError(e, this, arguments)
		}
	}	
	//-------------------------------------------------------------------------------
	jsl.console.info = function(msg) {
		try {
			var txt
		
			//@d[
			if(!arguments.length)	throw jsl.ParamError()//@d]
			
			for(var a = 1, params = []; a < arguments.length; a++)
				if(jsl.isArray(arguments[a])) params = params.concat(arguments[a])
				else													params.push(arguments[a])
			
			txt = jsl.compileMessage(msg + "", params)
			if(this.__log === "debug" || this.__log === "info")	jsl.__ni_stdout_info(txt)
			return txt
		}
		catch(e) {
			jsl.throwError(e, this, arguments)
		}
	}	
	//-------------------------------------------------------------------------------
	jsl.console.warn = function(msg) {
		try {
			var txt
			
			//@d[
			if(!arguments.length)	throw jsl.ParamError()//@d]
			
			for(var a = 1, params = []; a < arguments.length; a++)
				if(jsl.isArray(arguments[a])) params = params.concat(arguments[a])
				else													params.push(arguments[a])

			txt = jsl.compileMessage(msg + "", params)
			if(jsl.Object.isIn(this.__log, "debug", "info", "warn")) jsl.__ni_stdout_warn(txt)
			return txt
		}
		catch(e) {
			jsl.throwError(e, this, arguments)
		}
	}	
	//-------------------------------------------------------------------------------
	jsl.console.error = function(msg) {
		try {
			var txt
		
			//@d[
			if(!arguments.length)	throw jsl.ParamError()//@d]
			
			for(var a = 1, params = []; a < arguments.length; a++)
				if(jsl.isArray(arguments[a])) params = params.concat(arguments[a])
				else													params.push(arguments[a])
			
			txt = jsl.compileMessage(msg + "", params)
			if(this.__log !== "none")	jsl.__ni_stdout_error(txt)
			return txt
		}
		catch(e) {
			jsl.throwError(e, this, arguments)
		}
	}	
	//-------------------------------------------------------------------------------
	jsl.console.log = function() {
		try {
			var txt
		
			//@d[
			if(!arguments.length)	throw jsl.ParamError()//@d]			

			for(var a = 0, params = []; a < arguments.length; a++)
				if(jsl.isArray(arguments[a])) params = params.concat(arguments[a])
				else													params.push(arguments[a])

			txt = Array.prototype.join.call(params, "")
			jsl.__ni_stdout_log(txt)
			return txt
		}
		catch(e) {
			jsl.throwError(e, this, arguments)
		}
	}	
	//-------------------------------------------------------------------------------
	jsl.delay = function(action, time) {
		try {
      //@d[
			if(!arguments.length || arguments.length > 2) throw jsl.ParamError()
			jsl.validate(action, "f", "action")
			if(arguments.length === 2)	jsl.validate(time, "i+", "time")//@d]	
														
			return jsl.__ni_timer_create(action, arguments.length === 2 ? time : 0, 1)
		}
		catch(e) {
			jsl.throwError(e, this, arguments)
		}
	}
	//-------------------------------------------------------------------------------
	jsl.timer = function(action, interval, n) {
		try {
			//@d[			
      if(arguments.length !== 2 && arguments.length !== 3) throw jsl.ParamError()
			jsl.validate(action		, "f"		, "action")
			jsl.validate(interval	, "i++"	, "interval")	
			if(arguments.length === 3)	jsl.validate(n, "i++", "n")//@d]	
			
			return jsl.__ni_timer_create(action, interval, arguments.length === 3 ? n : Infinity)
		}
		catch(e) {
			jsl.throwError(e, this, arguments)
		}
	}
	//-------------------------------------------------------------------------------
	jsl.removeTimer = function(tid) { 
		try {
			//@d[
			if(arguments.length !== 1)	throw jsl.ParamError()
			jsl.validate(tid, "s+", "id")
      if(tid.charAt(0) !== "T")  	throw jsl.ParamError("BadId:tid:Timer-Id")//@d]

			return jsl.__ni_timer_remove(tid) 
		}
		catch(e) {
			jsl.throwError(e, this, arguments)
		}
	}
	//-------------------------------------------------------------------------------
	jsl.setUrlSchema = function(id, url) {
		try {
			var schema, v
			
			//@d[
			if(arguments.length !== 2) throw jsl.ParamError()
			jsl.validate(id	, "qid", "id")
			if(jsl.Object.isIn(id, "app", "liquid", "script"))	throw jsl.ParamError("ValueNotPermitted:id")
			if(id == "liquid" && !this.__schemes[id])						throw jsl.ConfigError("NotDefined:option(liquid.url)")
			jsl.validate(url, "url+")	 
			//@d]
			
			schema 	= url.match(/^[^:]+/)[0]
			v 			= this.__schemes[schema]
			v				= v ? v + url.match(/:\/+(.+$)/)[1] : url 
			v				= v.replace(/\\/g, "/")
			
			this.__schemes[id] = v.lastIndexOf("/") === v.length - 1 ? v + "" : v + "/"		
			return this
		}
		catch(e) {
			jsl.throwError(e, this, arguments)
		}
	}
	//-------------------------------------------------------------------------------
	jsl.getUrlSchema = function(id) {
		try {
			//@d[
			if(arguments.length !== 1) throw jsl.ParamError()
			jsl.validate(id, "qid", "id")
			//@d]
			
			return this.__schemes[id] || null
		}
		catch(e) {
			jsl.throwError(e, this, arguments)
		}
	}
	//-------------------------------------------------------------------------------
	jsl.captureError = function(e, cx, args) {
		
		if(!arguments.length  || arguments.length > 3)	jsl.captureError(jsl.ParamError().trace(this, arguments))

		try {
			var error, capture, evt, rv
														
			if(arguments.length === 1)			error = this.Error(e)
			else if(arguments.length === 2)	error = this.Error(e).trace(cx)
			else														error = this.Error(e).trace(cx, args)
			
			evt 			= new jsl.Event
			evt.error	= error
			rv				= this.throwEvent("beforeError", evt)		
			
			if(!rv.STOP_DEFAULT) {	
				capture = this.getOption("error.capture")					
				if(capture.enabled)	capture.action.call(this, evt.error)
			}
			
			if(!rv.STOP_EVENTS)			
				this.throwEvent("error", evt)

			this.__vars.error = error			
			return this
		}
		catch(e2) {
			//infinite recursion safe	
			throw jsl.Error(e2, e).trace(this, arguments)
		}
	}
